package com.travel.travel_springboot_web.mapper;

import com.travel.travel_springboot_web.entity.TokenBlacklist;
import org.apache.ibatis.annotations.*;

@Mapper
public interface TokenBlacklistMapper {
    @Insert("INSERT INTO token_blacklist (token, user_id, expired_at, created_at) " +
            "VALUES (#{token}, #{userId}, #{expiredAt}, NOW())")
    int insert(TokenBlacklist tokenBlacklist);
    
    @Select("SELECT COUNT(*) FROM token_blacklist WHERE token = #{token} AND expired_at > NOW()")
    int checkToken(String token);
    
    @Delete("DELETE FROM token_blacklist WHERE expired_at <= NOW()")
    int cleanExpired();
} 